﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class article_Default : System.Web.UI.Page
{
    public DataRow article;
    public DataRow author;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadArticle();
            Title = article["Title"].ToString();
        }
    }

    protected void LoadArticle()
    {
        int pid = 0;
        if (int.TryParse(Request.QueryString["pid"], out pid))
        {
            DataSet ds = new DataSet();
            ds = new DataSet();
            ds = new Cstudy.BLL.Artcles().SelectArtcleByID(pid, true);
            article = ds.Tables[0].Rows[0];
            LoadAuthor((int)article["AuthorID"]);
        }
    }

    protected void LoadAuthor(int authorid)
    {
        DataSet ds = new DataSet();
        ds = new Cstudy.BLL.Users().SelectUserByID(authorid);
        author = ds.Tables[0].Rows[0];
    }
}
